package com.da.demo;

/**
 * @Description: TODO(保存表的信息)
 * @Author da
 * @Date 2022/2/28 下午 12:05
 */
public class TableInfo
{
    //    表名
    private String tableName;
    //    表备注
    private String remarks;

    //    生成当前表的java代码
    public String createJavaCode()
    {
        return String.join("\n",
                "/**",
                " * 达哥出品,必属废品",
                " * 生成时间: " + StringUtil.getTime(),
                " * 表备注: " + this.remarks,
                " */",
                "public class " + StringUtil.tableNameToClassName(this.tableName) + " {",
//                占位字符,等会用属性替换
                "%body%",
                "}"
        );
    }


    public TableInfo()
    {
    }

    public TableInfo(String tableName, String remarks)
    {
        this.tableName = tableName;
        this.remarks = remarks;
    }

    @Override
    public String toString()
    {
        return "TableInfo{" +
                "tableName='" + tableName + '\'' +
                ", remarks='" + remarks + '\'' +
                '}';
    }

    public String getTableName()
    {
        return tableName;
    }

    public void setTableName(String tableName)
    {
        this.tableName = tableName;
    }

    public String getRemarks()
    {
        return remarks;
    }

    public void setRemarks(String remarks)
    {
        this.remarks = remarks;
    }
}

